import UIKit

class WallpaperEditTestViewController: UIViewController {
    
    let image1 = UIImage(named: "bg1")!
    let image2 = UIImage(named: "templateBack")!
    let image3 = UIImage(named: "templateFont")!
    let image = UIImage(named: "demoImg.jpg")!
    
    let imageEdit = UIImage(named: "defalut")!

    lazy var templateEditContainer: WallpaperEditView = {
        let w : CGFloat = 763
        let h : CGFloat = 1021
        let frame = CGRect(x: 284, y: 835, width: w, height: h)
        var imageInfos = [WallpaperImageInfo]()
        imageInfos.append(WallpaperImageInfo(imageFrame: frame, originImage: image))
        let info = WallpaperEditInfo(bgImage: image1,backImage: image2, fontImage: image3, imageInfos: imageInfos)
        let v = WallpaperEditView()
        v.setEditInfo(info)
        v.clipsToBounds = true
        v.onAddImage = {[weak self] index in
            if let self = self {
                v.setImage(index: index, image: self.imageEdit)
            }
        }
        return v
    }()
    

    override func viewDidLoad() {
        super.viewDidLoad()
        createSubview()
    
    }
    
    // Methods
    func createSubview() {
        view.backgroundColor = .white
        view.addSubview(templateEditContainer)
        templateEditContainer.snp.makeConstraints { make in
            make.edges.equalToSuperview()
        }
    }
}
